package com.party.core.service.commune.impl;

import com.party.common.paging.Page;
import com.party.core.dao.read.commune.CNotebookTypeReadDao;
import com.party.core.dao.write.commune.CNotebookTypeWriteDao;
import com.party.core.dao.write.commune.CNotebookWriteDao;
import com.party.core.model.BaseModel;
import com.party.core.model.commune.CNotebook;
import com.party.core.model.commune.CNotebookType;
import com.party.core.service.commune.ICNotebookTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @program: party
 * @description: 笔记本类型
 * @author: Hua Qunhao
 * @create: 2019-12-26 10:19
 **/
@Service
public class CNotebookTypeService implements ICNotebookTypeService {
    @Autowired
    private CNotebookTypeWriteDao notebookTypeWriteDao;
    @Autowired
    private CNotebookTypeReadDao notebookTypeReadDao;

    @Override
    public String insert(CNotebookType cNotebookType) {
        BaseModel.preInsert(cNotebookType);
        boolean result = notebookTypeWriteDao.insert(cNotebookType);
        if (result) {
            return cNotebookType.getId();
        }
        return null;
    }

    @Override
    public boolean update(CNotebookType cNotebookType) {
        cNotebookType.setUpdateDate(new Date());
        return notebookTypeWriteDao.update(cNotebookType);
    }

    @Override
    public boolean deleteLogic(String id) {
        return false;
    }

    @Override
    public boolean delete(String id) {
        return notebookTypeWriteDao.delete(id);
    }

    @Override
    public boolean batchDeleteLogic(Set<String> ids) {
        return false;
    }

    @Override
    public boolean batchDelete(Set<String> ids) {
        return false;
    }

    @Override
    public CNotebookType get(String id) {
        return notebookTypeReadDao.get(id);
    }

    @Override
    public List<CNotebookType> listPage(CNotebookType cNotebookType, Page page) {
        return notebookTypeReadDao.listPage(cNotebookType, page);
    }

    @Override
    public List<CNotebookType> list(CNotebookType cNotebookType) {
        return notebookTypeReadDao.listPage(cNotebookType, null);
    }

    @Override
    public List<CNotebookType> batchList(Set<String> ids, CNotebookType cNotebookType, Page page) {
        return null;
    }

    @Override
    public Integer getCNotebookTypeCount(CNotebookType cNotebookType) {
        return notebookTypeReadDao.getCNotebookTypeCount(cNotebookType);
    }

    @Override
    public List<Map<String, Object>> mobileListPage(Map<String, Object> params, Page page) {
        return notebookTypeReadDao.mobileListPage(params, page);
    }
    @Override
    public List<CNotebookType> webListPage(Map<String, Object> params, Page page) {
        return notebookTypeReadDao.webListPage(params, page);
    }
}
